/*
 * File: UpdateTripName.java Author: Robert Bittle <guywithnose@gmail.com>
 */
package triperest.servlets;

import java.io.IOException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import triperest.Trip;

/**
 * The Class UpdateTripName.
 */
public class UpdateTripName extends HttpServlet
{

    /*
     * (non-Javadoc)
     * 
     * @see
     * javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest
     * , javax.servlet.http.HttpServletResponse)
     */
    @Override
    public void doPost(HttpServletRequest req, HttpServletResponse resp)
            throws IOException
    {

        resp.setContentType("text/plain");
        Trip trip = new Trip(Long.valueOf(req.getParameter("trip")));
        trip.setName(req.getParameter("name"));
        trip.save();

    }
}
